#!/bin/bash
# this file do these things:
#1. transfer the mapped documentId to originalId ->*.ori
#2. delete the weight of the related questions   ->*.ori.trim
#3. zip the *.ori.trim                           ->*.ori.trim.bz2
#4. scp the *.ori.trim to s1
#5. unzip the *.ori.trim.bz2 to *.ori.trim on s1

if [ $# -ne 1 ];
then
    echo "usage: restoreAndScp age_id";
    exit
else
    age_id=$1
fi
dataPath="/data/lvhongliang/data/ask/${age_id}"

echo "step 1: transfer the mapped documentId to originalId ->*.ori"
./restoreToOriginalDocId.sh "$dataPath/sim_tfidf_${age_id}_step_9" \
        "/data/lvhongliang/data/ask/${age_id}/sim_tfidf_${age_id}_step_9.ori" "/data/lvhongliang/data/ask/${age_id}/doc_id.map"

echo "step 2: delete the weight of the related questions   ->*.ori.trim"
../link_analyse/deleteWeight.sh "/data/lvhongliang/data/ask/${age_id}/sim_tfidf_${age_id}_step_9.ori" > \
        "/data/lvhongliang/data/ask/${age_id}/sim_tfidf_${age_id}_step_9.ori.trim"

echo "step 3: zip the *.ori.trim   ->*.ori.trim.bz2"
bzip2  "$dataPath/sim_tfidf_${age_id}_step_9.ori.trim"

echo "step 4: scp the *.ori.trim to s1"
scp "$dataPath/sim_tfidf_${age_id}_step_9.ori.trim.bz2"  lvhongliang@s1:related_data_full/

echo "step 5: unzip the *.ori.trim.bz2 to *.ori.trim on s1"
ssh lvhongliang@s1 "bunzip2 ~/related_data_full/sim_tfidf_${age_id}_step_9.ori.trim.bz2"

